# Yamllint of yaml files.

# This uses rules from project root `.yamllint`.
lint-yaml:
  extends:
    - .default-retry
    - .yaml-lint:rules
  image: pipelinecomponents/yamllint:latest
  stage: lint
  needs: []
  script:
    - yamllint --strict -f colored .

# The jobs below will not use the configuration present in `.yamllint` (it's because of the -d option)
#
# Docs: https://yamllint.readthedocs.io/en/stable/configuration.html#custom-configuration-without-a-config-file

lint-pipeline-yaml:
  extends:
    - .default-retry
    - .lint-pipeline-yaml:rules
  image: pipelinecomponents/yamllint:latest
  stage: lint
  needs: []
  variables:
    LINT_PATHS: .gitlab-ci.yml .gitlab/ci lib/gitlab/ci/templates data/deprecations data/whats_new
  script:
    - 'yamllint -d "{extends: default, rules: {line-length: disable, document-start: disable}}" $LINT_PATHS'

lint-metrics-yaml:
  extends:
    - .default-retry
    - .lint-metrics-yaml:rules
  image: pipelinecomponents/yamllint:latest
  stage: lint
  needs: []
  variables:
    LINT_PATHS: config/metrics
  script:
    - 'yamllint --strict -f colored -d "{extends: default, rules: {line-length: disable, document-start: disable, indentation: {spaces: 2, indent-sequences: whatever}}}" $LINT_PATHS'
